<%@page contentType="text/html; charset=utf-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>主页 - Fly社区</title>
    <link rel="stylesheet" type="text/css" href="../commons/iconfont/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="../commons/layui/css/layui.css"/>
    <link rel="stylesheet" type="text/css" href="../style/global.css"/>
    <script src="../js/jquery-3.3.1.min.js" type="text/javascript"></script>
    <script src="../commons/layui/layui.js" type="text/javascript" charset="utf-8"></script>
</head>
<body class="fly-full">
<div class="fly-header layui-bg-black">
    <div class="layui-container"><a class="fly-logo" name="headlink" href="javascript:gotoIndex();"> <img
            src="../img/logo.png"
            alt="layui">
    </a>
        <ul class="layui-nav fly-nav layui-hide-xs">
            <li class="layui-nav-item layui-this"><a href="javascript:gotoIndex();"><i
                    class="iconfont icon-jiaoliu"></i>交流</a>
            </li>
            <li class="layui-nav-item"><a href="javascript:;"><i class="iconfont icon-chanpin"
                                                                 style="top: 1px;"></i>专区<span
                    class="layui-nav-more"></span></a>
                <dl class="layui-nav-child fly-nav-child layui-anim layui-anim-upbit">
                    <dd><a href="/vipclub/list/layuiadmin/">layuiAdmin</a></dd>
                    <hr>
                    <dd><a href="/vipclub/list/layim/">LayIM</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item"><a href="http://www.layui.com/"><i class="iconfont icon-ui"></i>框架</a></li>
            <c:if test="${!empty currentUser}">
                <li class="layui-nav-item nav-user"><a class="fly-nav-avatar" href="/user/" id="LAY_header_avatar">
                    <cite
                            class="layui-hide-xs">${currentUser.nickName}</cite> <img
                        src="../upload/${currentUser.headImg}"><span
                        class="layui-nav-more"></span></a>
                    <dl class="layui-nav-child layui-anim layui-anim-upbit">
                        <dd><a href="javascript:gotoUserCenter();">用户中心</a></dd>
                        <dd><a href="javascript:gotoUserAset();">基本设置</a></dd>
                        <hr>
                        <dd><a href="javascript:gotoUserMsg();">我的消息</a></dd>
                        <dd><a href="/user/product/">已购产品</a></dd>
                        <dd><a href="javascript:gotoUserHomepage();">我的主页</a></dd>
                        <hr style="margin: 5px 0;">
                        <dd><a href="javascript:logOut();" style="text-align: center;">退出</a></dd>
                    </dl>
                </li>
            </c:if>
        </ul>
        <c:if test="${empty currentUser}">
            <ul class="layui-nav fly-nav-user">
                <li class="layui-nav-item"><a class="iconfont icon-touxiang layui-hide-xs"
                                              href="https://fly.layui.com/user/login/"></a>
                </li>
                <li class="layui-nav-item"><a href="../page/login-register.jsp">登入</a></li>
                <li class="layui-nav-item"><a href="../page/login-register.jsp">注册</a></li>
                <li class="layui-nav-item layui-hide-xs"><a href="https://fly.layui.com/app/qq/"
                                                            onclick="layer.msg('&#39;正在通过QQ登入&#39;, {icon:16, shade: 0.1, time:0}')"
                                                            title="QQ登入" class="iconfont icon-qq"></a></li>
                <li class="layui-nav-item layui-hide-xs"><a href="https://fly.layui.com/app/weibo/"
                                                            onclick="layer.msg('&#39;正在通过微博登入&#39;, {icon:16, shade: 0.1, time:0}')"
                                                            title="微博登入" class="iconfont icon-weibo"></a></li>
            </ul>
        </c:if>
    </div>
</div>
<div class="fly-home fly-panel"><img class="headImg" src="" >
    <h1 class="nickName"><i class="iconfont icon-nan"></i></h1>
    <p class="fly-home-info"><i class="iconfont icon-kiss" title="飞吻"></i><span class="kiss"
            style="color: #FF7200;"></span> <i
            class="iconfont icon-shijian"></i><span class="createTime"></span> <i
            class="iconfont icon-chengshi"></i><span class="city"></span>
    </p>
    <p class="fly-home-sign sign"></p>
</div>
<div class="layui-container">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md6 fly-home-jie">
            <div class="fly-panel">
                <h3 class="fly-panel-title"> 最近的提问</h3>
                <ul class="jie-row" id="title">

                </ul>
            </div>
        </div>
        <div class="layui-col-md6 fly-home-da">
            <div class="fly-panel">
                <h3 class="fly-panel-title"> 最近的回答</h3>
                <ul class="home-jieda">
                    <div class="fly-none" style="min-height: 50px; padding:30px 0; height:auto;"><span>没有回答任何问题</span>
                    </div>
                </ul>
            </div>
        </div>
    </div>
</div>
<div class="fly-footer">
    <p><a href="http://fly.layui.com/">Fly 社区</a> 2019 © <a href="http://www.layui.com/">layui.com</a></p>
    <p><a href="http://fly.layui.com/jie/3147/" target="_blank">付费计划</a> <a href="https://fly.layui.com/extend/"
                                                                            target="_blank">组件平台</a>
        <a href="https://fly.layui.com/store/" target="_blank">模板市场</a> <a href="https://fly.layui.com/case/2019/"
                                                                           target="_blank">年度案例</a>
        <a href="http://fly.layui.com/jie/2461/" target="_blank">公众号</a></p>
    <div class="fly-union">
        <p style="display: block; margin-bottom: 10px;"><span>感谢以下平台提供云加速支持</span></p>
        <p><a href="https://console.upyun.com/register/?invite=SJ0wu6g2-" target="_blank" rel="nofollow"
              sponsor="upyun">
            <img src="../img/upyun.png"> </a> <a
                href="https://www.maoyuncloud.com/?from=layui" target="_blank"
                rel="nofollow" sponsor="maoyun"> <img src="../img/168_1559291577683_9348.png"> </a></p>
    </div>
</div>
<ul class="layui-fixbar">
    <li class="layui-icon" lay-type="bar1" style="background-color:#009688"></li>
    <li class="layui-icon layui-fixbar-top" lay-type="top" style="background-color:#009688"></li>
</ul>
<script>
    window.onload = function () {
        let loc = location.href;//获取整个跳转地址内容
        let index = loc.indexOf("=");//取得=号的位置
        let userId = loc.substring(index+1);
        console.log(userId);
        $.post('../user/userCenter',{"userId":userId},function (result) {
            let data = result.data;
            $(".headImg").attr("src","../upload/"+data.headImg);
            $(".nickName").html(data.nickName);
            $(".kiss").html(data.kiss+"飞吻");
            $(".createTime").html(data.createTime+" 加入");
            $(".city").html("来自"+data.city);
            $(".sign").html("("+data.signature+")");
        });
        $.post('../reply/findReplyByUserId', {"userId": userId}, function (result) {
            let data = result.data;
            let html = "";
            console.log(data);
            for (var i = 0; i < data.length; i++) {
                html += '<li > <a href="javascript:gotoReplyPost('+data[i].postId+');">' + data[i].replyContext + '</a> <i>20分钟前</i> <em class="layui-hide-xs">34阅/4答</em></li>';
            }
            $("#title").append(html);
        });
    };
    layui.use(['util', 'carousel', 'layer', 'element', 'jquery'], function () {
        var util = layui.util,
            carousel = layui.carousel,
            layer = layui.layer,
            element = layui.element,
            $ = layui.jquery;
        //固定块
        util.fixbar({
            bar1: '&#xe642;',
            css: {
                right: 20,
                bottom: 15
            },
            bgcolor: '#009688',
            click: function (type) {
                if (type === 'bar1') {
                    layer.msg('icon是可以随便换的')
                }
            }
        });
    });
</script>
<script src="../js/index.js" type="text/javascript" charset="utf-8"></script>
</body>
</html>
